<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>添加新的文章 - 我的笔记</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    
  </head>
  <body style="" data-ng-app="myApp" data-ng-controller="myCtrl">
  
  <!-- ‘完成’ 提示框开始 -->
  <div class="alert alert-success alert-dismissible" role="alert" data-ng-hide="success | isNull">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <strong data-ng-bind="success"></strong>
  </div>
  <!-- ‘完成’ 提示框结束 -->
  
  <!-- ‘错误’ 提示框开始 -->
  <div class="alert alert-danger alert-dismissible" role="alert" data-ng-hide="danger | isNull">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <strong data-ng-bind="danger"></strong>
  </div>
  <!-- ‘错误’ 提示框结束 -->
  
  
  
  <div class="row">
    <form action="iframeUEditor.jsp?action=edit" method="post">
      <!-- 加载编辑器的容器 -->
      <input type="hidden" name="code" value="1" />
      
      <button type="submit" style="width:100px;" >提交保存</button>
    </form>
  </div>
    

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="ueditor/lang/zh-cn/zh-cn.js"></script>
    
    <script>
      //实例化编辑器
      //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
      var ue = UE.getEditor('editor');
  	
      ue.addListener( 'contentChange', function( editor ) {
          console.log(ue.getAllHtml());
          $('#preview-div').html(ue.getAllHtml());
      });
      
      var app = angular.module('myApp', []);
      app.controller('myCtrl', function($scope, $http) {
        $scope.danger = "";
        $scope.success = "";
        
        $scope.isLogin = function(){
          $http.get("/isLogin")
        	    .success(function(data) {
              if(data.Login > 0){
                $scope.UserName = data.UserName;
              } else {
                $scope.UserName = '';
              }
        	  });
        };
        $scope.isLogin(); // 判断是否已经登录
      });
      
      // 过滤器，判断内容是否为空
      app.filter("isNull", function(){
        return function(input){
       		if(input == undefined || input == '' || input.length < 1){
       			return true;
       		} else {
       			return false;
       		}
        }
      });
    </script>
  </body>
</html>
